﻿using DataSyncCommon.Model;
using Newtonsoft.Json;
using Serilog;
using Serilog.Core;
using System;
using System.IO;

namespace DataSyncCommon
{
    public static class LogHelper
    {
        public static Logger logger = null;
        private static object lock1 = new object();
        public static Logger CreateLoger()
        {
            if (logger == null)
            {
                lock (lock1)
                {
                    if (logger == null)
                    {
                        logger = new LoggerConfiguration()
                   .WriteTo.File(Path.Combine("logs", $"{DateTime.Now:MMdd}.txt"), (Serilog.Events.LogEventLevel)RollingInterval.Day)//写到文本Serilog.Sinks.File
                   .CreateLogger();
                    }
                }
            }
            return logger;
        }

       
    }

}